package sgbag1.Vues;

import java.awt.Graphics;

import java.awt.Point;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JPanel;

public class TestPanel extends JPanel{
    
    private VueAeroport object;
    
    public TestPanel() {
        try {
            jbInit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        this.setLayout( null );
    }
    
    public void setAeroport(VueAeroport v){
        object = v;    
        object.setTailleFenetre(this.getWidth(), this.getHeight());
        //object.setTailleFenetre(this.getWidth(), this.getHeight());
    }
    
    public void paintComponent(Graphics g){
        super.paintComponent(g);                           
        if(object != null){
            object.setTailleFenetre(this.getWidth(), this.getHeight());
            object.Dessiner(g);            
        }
    }

    public void click(MouseEvent e){
        System.out.println(object.getElementClique(e.getX(), e.getY()));
        this.repaint();
    }
}
